<?php

/**
 * Homework form base class.
 *
 * @package    elearning
 * @subpackage form
 * @author     Your name here
 */
class BaseHomeworkForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'level_id'       => new sfWidgetFormPropelChoice(array('model' => 'Level', 'add_empty' => false)),
      'teacher_id'     => new sfWidgetFormPropelChoice(array('model' => 'Teacher', 'add_empty' => false)),
      'hw_code'        => new sfWidgetFormInput(),
      'hw_description' => new sfWidgetFormTextarea(),
      'hw_link'        => new sfWidgetFormInput(),
      'hw_status'      => new sfWidgetFormInput(),
      'hw_pulished'    => new sfWidgetFormInput(),
      'created_at'     => new sfWidgetFormDateTime(),
      'updated_at'     => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorPropelChoice(array('model' => 'Homework', 'column' => 'id', 'required' => false)),
      'level_id'       => new sfValidatorPropelChoice(array('model' => 'Level', 'column' => 'id')),
      'teacher_id'     => new sfValidatorPropelChoice(array('model' => 'Teacher', 'column' => 'id')),
      'hw_code'        => new sfValidatorString(array('max_length' => 12)),
      'hw_description' => new sfValidatorString(array('required' => false)),
      'hw_link'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'hw_status'      => new sfValidatorInteger(array('required' => false)),
      'hw_pulished'    => new sfValidatorInteger(array('required' => false)),
      'created_at'     => new sfValidatorDateTime(array('required' => false)),
      'updated_at'     => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('homework[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Homework';
  }


}
